/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent;
    overflow: hidden;
    user-select: none;
}

.widget-container {
    width: 300px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.widget-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 10px 10px 0 0;
    cursor: move;
    position: relative;
}

.widget-header h3 {
    font-size: 16px;
    font-weight: 500;
}

.window-controls {
    position: absolute;
    top: 10px;
    right: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    margin-left: 5px;
    transition: background 0.3s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.widget-content {
    padding: 15px;
}

.status-section, .tasks-section, .reports-section {
    margin-bottom: 20px;
}

.status-section h4, .tasks-section h4, .reports-section h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
}

.status-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    background: #e0e0e0;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    color: white;
    font-weight: 500;
}

#change-status-btn, #manage-status-btn, #manage-tasks-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
}

#change-status-btn:hover, #manage-status-btn:hover, #manage-tasks-btn:hover {
    background: #5a6fd8;
}

.task-filters {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: #e9ecef;
    border: none;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    cursor: pointer;
}

.filter-btn.active {
    background: #667eea;
    color: white;
}

#task-list {
    list-style: none;
    max-height: none; /* 移除最大高度限制，让任务列表自适应内容高度 */
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.5);
    min-height: 40px;
    position: relative;
    z-index: 1;
}

.task-item {
    padding: 8px 5px;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.empty-task {
    justify-content: center;
    color: #999;
    font-style: italic;
    border-bottom: none;
}

.task-title {
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.task-title.completed {
    text-decoration: line-through;
}

.task-meta {
    display: flex;
    gap: 3px;
}

.task-priority {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 5px;
}

.priority-high {
    background: #dc3545;
    color: white;
}

.priority-medium {
    background: #ffc107;
    color: #333;
}

.priority-low {
    background: #28a745;
    color: white;
}

.task-status-badge {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 5px;
    background: #6c757d;
    color: white;
    cursor: pointer;
    pointer-events: auto;
    transition: background-color 0.2s ease;
}

.task-status-badge:hover {
    filter: brightness(1.2);
}

.status-pending {
    background: #6c757d;
}

.status-in-progress {
    background: #17a2b8;
}

.status-completed {
    background: #28a745;
}

.task-actions {
    display: flex;
    gap: 3px;
}

.task-action-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 3px;
}

.task-action-btn:hover {
    background: #e9ecef;
}

/* 任务操作按钮行 */
.task-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

#add-task-btn, #manage-tasks-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    flex: 1;
    transition: background-color 0.2s ease;
}

#add-task-btn:hover, #manage-tasks-btn:hover {
    background: #218838;
}

.reports-section button {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.reports-section button:hover {
    background: #138496;
}

.reports-section button:last-child {
    margin-right: 0;
}

/* 调整大小手柄 */
.resize-handle {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    font-size: 16px;
    color: #999;
    text-align: center;
    line-height: 20px;
    user-select: none;
}

/* 新建挂件按钮和设置按钮 */
#create-widget-btn, #settings-btn {
    position: absolute;
    background: #667eea;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    z-index: 1000;
    transition: all 0.3s ease;
}

#create-widget-btn {
    bottom: 60px;
    right: 10px;
}

#settings-btn {
    bottom: 30px;
    right: 10px;
    background: #28a745;
}

#create-widget-btn:hover, #settings-btn:hover {
    transform: scale(1.05);
}

/* 确保按钮在调整大小时保持在正确位置 */
.widget-container:hover #create-widget-btn,
.widget-container:hover #settings-btn {
    visibility: visible;
}